<?php
class Goods_model extends CI_Model 
{
    function __construct()
    {
        parent::__construct();
        
        $this->load->database();
    }
    
    function get_goods_list($params = NULL)
    {
    	//return $this->db->get_where();
    	if ( ! empty($params))
    	{
	    	foreach($params as $k => $v)
	    	{
	    		$this->db->where($k, $v);
	    	}
    	}
    	
    	$this->db->from('fm_goods');
    	$sum = $this->db->count_all_results();
    	
    	//$res = $this->db->get('fm_goods');
    	//$res = $this->db->query('select * from fm_goods')->result_array();
    	$ctl = CI_Controller::get_instance(); 
    	$sql = 'select * from fm_goods';
    	$ctl->load->library('pager', array('sql' => $sql));
    	
    	return $ctl->pager;
    }

    function insert()
    {
    }

    function update()
    {
    }
}
